# import requests
#
# urls = [f'https://push2.eastmoney.com/api/qt/clist/get?np=1&fltt=1&invt=2&fs=m%3A0%2Bt%3A6%2Bf%3A!2%2Cm%3A0%2Bt%3A80%2Bf%3A!2%2Cm%3A1%2Bt%3A2%2Bf%3A!2%2Cm%3A1%2Bt%3A23%2Bf%3A!2%2Cm%3A0%2Bt%3A81%2Bs%3A262144%2Bf%3A!2&fields=f12%2Cf13%2Cf14%2Cf1%2Cf2%2Cf4%2Cf3%2Cf152%2Cf5%2Cf6%2Cf7%2Cf15%2Cf18%2Cf16%2Cf17%2Cf10%2Cf8%2Cf9%2Cf23&fid=f3&pn={t}&pz=20&po=1&dect=1&ut=fa5fd1943c7b386f172d6893dbfba10b&wbp2u=%7C0%7C0%7C0%7Cweb&_=1762236251168' for t in range(1, 273)]
#
# headers = {
# 'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36',
# 'cookie':'fullscreengg=1; fullscreengg2=1; qgqp_b_id=59e1caa8fe64b12fdf61a7b1fe90903d; st_nvi=h73s8AysTMhNzBPnzOk6lae68; st_si=45428190835025; st_pvi=55593833191006; st_sp=2025-11-04%2014%3A03%3A49; st_inirUrl=; nid=058d3aafd10f4a79690de498e3244c04; nid_create_time=1762236230423; gvi=y4bB9HL-cXCkxJtdILCEyb065; gvi_create_time=1762236230423'
#
# }
# for url in urls:
#     print('开始爬取')
#     response = requests.get(url,headers=headers)
#     datas = response.json()['data']['diff']
#     for data in datas:
#         print(data)
#     print(datas)
#     print(response.status_code)
import concurrent
# import asyncio
# import aiohttp
#
# headers = {
# 'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36',
# 'cookie':'fullscreengg=1; fullscreengg2=1; qgqp_b_id=59e1caa8fe64b12fdf61a7b1fe90903d; st_nvi=h73s8AysTMhNzBPnzOk6lae68; st_si=45428190835025; st_pvi=55593833191006; st_sp=2025-11-04%2014%3A03%3A49; st_inirUrl=; nid=058d3aafd10f4a79690de498e3244c04; nid_create_time=1762236230423; gvi=y4bB9HL-cXCkxJtdILCEyb065; gvi_create_time=1762236230423'
#
# }
#
# async def fetch(session,url):
#     async with session.get(url) as response:
#         result = await response.json()
#         return result
#
#
# async def main():
#     async with aiohttp.ClientSession(headers=headers) as session:
#         datas = await asyncio.gather(*[fetch(session,f'https://push2.eastmoney.com/api/qt/clist/get?np=1&fltt=1&invt=2&fs=m%3A0%2Bt%3A6%2Bf%3A!2%2Cm%3A0%2Bt%3A80%2Bf%3A!2%2Cm%3A1%2Bt%3A2%2Bf%3A!2%2Cm%3A1%2Bt%3A23%2Bf%3A!2%2Cm%3A0%2Bt%3A81%2Bs%3A262144%2Bf%3A!2&fields=f12%2Cf13%2Cf14%2Cf1%2Cf2%2Cf4%2Cf3%2Cf152%2Cf5%2Cf6%2Cf7%2Cf15%2Cf18%2Cf16%2Cf17%2Cf10%2Cf8%2Cf9%2Cf23&fid=f3&pn={t}&pz=20&po=1&dect=1&ut=fa5fd1943c7b386f172d6893dbfba10b&wbp2u=%7C0%7C0%7C0%7Cweb&_=1762236251168')for t in range(1, 5)])
#         for data in datas:
#             items = data['data']['diff']
#             for item in items:
#                 print(item['f14'])
#
#
#
#
# asyncio.run(main())



import threading

import requests
import concurrent.futures

headers = {
'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36',
'cookie':'fullscreengg=1; fullscreengg2=1; qgqp_b_id=59e1caa8fe64b12fdf61a7b1fe90903d; st_nvi=h73s8AysTMhNzBPnzOk6lae68; st_si=45428190835025; st_pvi=55593833191006; st_sp=2025-11-04%2014%3A03%3A49; st_inirUrl=; nid=058d3aafd10f4a79690de498e3244c04; nid_create_time=1762236230423; gvi=y4bB9HL-cXCkxJtdILCEyb065; gvi_create_time=1762236230423'

}

urls = [f'https://push2.eastmoney.com/api/qt/clist/get?np=1&fltt=1&invt=2&fs=m%3A0%2Bt%3A6%2Bf%3A!2%2Cm%3A0%2Bt%3A80%2Bf%3A!2%2Cm%3A1%2Bt%3A2%2Bf%3A!2%2Cm%3A1%2Bt%3A23%2Bf%3A!2%2Cm%3A0%2Bt%3A81%2Bs%3A262144%2Bf%3A!2&fields=f12%2Cf13%2Cf14%2Cf1%2Cf2%2Cf4%2Cf3%2Cf152%2Cf5%2Cf6%2Cf7%2Cf15%2Cf18%2Cf16%2Cf17%2Cf10%2Cf8%2Cf9%2Cf23&fid=f3&pn={t}&pz=20&po=1&dect=1&ut=fa5fd1943c7b386f172d6893dbfba10b&wbp2u=%7C0%7C0%7C0%7Cweb&_=1762236251168' for t in range(1, 10)]


def fetch(url):
    res = requests.get(url,headers=headers)
    print(url,res.json())


with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor:
    for url in urls:
        executor.submit(fetch, url)
